package com.example.tuter.util.httpUtil.HttpFunction;

import com.example.tuter.entity.Comment;
import com.example.tuter.entity.Floor;
import com.example.tuter.entity.Message;
import com.example.tuter.entity.PageResult;
import com.example.tuter.entity.Post;

import java.util.ArrayList;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;

public interface CommunityAPI {



    //{{url}}/post/:pid
    @GET("/post/{pid}")
    Call<Message<Post>> getPostByPid(@Path("pid")Integer pid);

    //{{url}}/post/post
    @POST("/post/post")
    @FormUrlEncoded
    Call<Message<PageResult<Post>>> getPost(@Field("timestamp")String timestamp,
                                        @Field("keyword")String keyword,
                                        @Field("pageSize")Integer pageSize,
                                        @Field("type")Integer type);
    @POST("/post/searchPost")
    @FormUrlEncoded
    Call<Message<PageResult<Post>>> searchPost(
                                            @Field("keyword")String keyword,
                                            @Field("pageSize")Integer pageSize,
                                            @Field("pageNo")Integer pageNo,
                                            @Field("type")Integer type);
    //{{url}}/post/publishPost
    @POST("/post/publishPost")
    @FormUrlEncoded
    Call<Message<Post >> publishPost(@Field("title")String title,
                                    @Field("description")String description,
                                    @Field("type")Integer type,
                                    @Field("pic1")String picAddress);
    //{{url}}/floor/floor
    @POST("/floor/floor")
    @FormUrlEncoded
    Call<Message<PageResult<Floor>>> getFloor(@Field("pid")Integer pid,
                                             @Field("pageNo")Integer pageNo);
    //{{url}}/floor/publishFloor
    @POST("/floor/publishFloor")
    @FormUrlEncoded
    Call<Message<Floor>> publishFloor(@Field("pid")Integer pid,
                                         @Field("content")String content,
                                         @Field("pic1")String picAddress);

    //{{url}}/comment/comment
    @POST("/comment/comment")
    @FormUrlEncoded
    Call<Message<PageResult<Comment>>> getComment(@Field("fid")Integer fid, @Field("pageNo")Integer pageNo);

    //{{url}}/comment/sendComment
    @POST("/comment/sendComment")
    @FormUrlEncoded
    Call<Message<Comment >> sendComment(@Field("fid")Integer fid,@Field("content")String content);


    //{{url}}/post/like/:pid
    @GET("/post/like/{pid}")
    Call<Message<String >> like(@Path("pid")Integer pid);

    //{{url}}/post/del/:pid
    @GET("/post/del/{pid}")
    Call<Message<String >> unlike(@Path("pid")Integer pid);


    //{{url}}/floor/del/:fid
    @GET("/floor/del/{fid}")
    Call<Message<String >> delFloor(@Path("fid")Integer fid);
    //{{url}}/comment/allComment/:fid
    @GET("/comment/allComment/{fid}")
    Call<Message<ArrayList<Comment>>> getAllComments(@Path("fid")Integer fid);
    @POST("/post/recommend")
    @FormUrlEncoded
    Call<Message<PageResult<Post>>> getRecommend(@Field("pageNo")Integer pageNo,@Field("drive")Integer drive);

}
